home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Text / print / HPDJ900Src.lha / density.c < prev    next >
C/C++ Source or Header  |  2004-05-18  |  1KB  |  45 lines

  1. /*
  2.  *
  3.  *       Density module for HP_DeskJet_900C
  4.  *
  5. */
  6.  
  7. #include "global.h"
  8.  
  9. #define DENSITY 15
  10.  
  11.  
  12. void SetDensity(ULONG density_code)
  13. {
  14.         extern struct PrinterData *PD;
  15.         extern struct PrinterExtendedData *PED;
  16.         extern char StartCmd[];
  17.  
  18.         /* SPECIAL_DENSITY     0   1   2    3    4    5    6    7 */
  19.         static int XDPI[8] = {150, 150, 150, 300, 300, 600, 600, 600};
  20.         static char codes[8][4] = {
  21.         {'1','5','0'},{'1','5','0'},{'1','5','0'},{'3','0','0'},
  22.         {'3','0','0'},{'6','0','0'},{'6','0','0'},{'6','0','0'},
  23.         };
  24.         density_code /= SPECIAL_DENSITY1;
  25.         PED->ped_MaxXDots = XDPI[density_code] * 8;
  26.  
  27.         /* David Berezowski - April 22/90 */
  28.         /* default is 10.0, US_LEGAL is 14.0 */
  29.         PED->ped_MaxYDots =
  30.                 PD->pd_Preferences.PaperSize == US_LEGAL ? 14 : 10;
  31.         PED->ped_MaxYDots *= XDPI[density_code];
  32.  
  33.         PED->ped_XDotsInch = PED->ped_YDotsInch = XDPI[density_code];
  34.         
  35.         /* Density 5 = 600 x 300 */
  36.         if (density_code == 5) { 
  37.                 PED->ped_YDotsInch = 300;
  38.                 PED->ped_MaxYDots /= 2;
  39.             }
  40.  
  41.         StartCmd[DENSITY]   = codes[density_code][0];
  42.         StartCmd[DENSITY+1] = codes[density_code][1];
  43.         StartCmd[DENSITY+2] = codes[density_code][2];
  44. }
  45.